const {ccclass, property} = cc._decorator;

@ccclass
export default class aniBase extends cc.Component {
    private _timer:number = 0;
    private _time:number = 0;
    private _isDone:boolean = true;

    //reWrite
    process(dt){
    }

    //reWrite
    Done(){
    }

    playBase(time){
        this._isDone = false;
        this._timer = 0;
        this._time = time;
    }

    update(dt) {
        if(this.node.active == false) return;
        if(this._isDone) return;

        this._timer += dt;
        this.process((this._timer + Math.random()/1000) / this._time);

        if (this._timer >= this._time) {
            this._isDone = true;
            this.Done();
        }
    }
}